class RequestJS
{
    fetch(url, options)
    {
        let headers = {
            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.0",
            "Content-Type":"application/json",
            "Accept": "*/*",
            "Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
            "Sec-Fetch-Dest": "empty",
            "Sec-Fetch-Mode": "cors",
            "Sec-Fetch-Site": "same-origin"
        };
        let optionConfig = {
            "credentials": "include",
            "mode": "cors",
            "mothod": "GET"
        };

        if (options) {
            if (options.method) {
                optionConfig.method = options.method;
            }
    
            if (options.token) {
                optionConfig.authorization = "Bearer " + options.token;
            }
    
            if (options.body) {
                optionConfig.body = options.body;
            }

            if (options.headers) {
                Object.keys(options.headers).forEach(function(key){
                    headers[key] = options.headers[key];
                });
            }
        }

        optionConfig.headers = headers;

        return fetch(url, optionConfig);
    }
}
var requestJs = new RequestJS();